package model;

import java.util.Observable;
import java.util.Observer;
import java.util.Vector;

/**
 * Team EBE
 * 
 * PackageEditor.java is an intermediary with functionality to edit a given package so that 
 * views do not have to directly access the package itself; Used primarily by the 
 * package editor GUI; Currently it implements observer although we are not fully 
 * implementing the functionality yet
 *
 */

public class PackageEditor implements Observer{
	
	private PackageImpl packageToEdit;
	public PackageEditor(PackageImpl packageToEditIn){
		packageToEdit = packageToEditIn;
	}
	
	public void commitEdits(String nameIn, int oXIn, int oYIn, int sizeXIn, int sizeYIn) {
		packageToEdit.setName(nameIn);
		packageToEdit.setoX(oXIn);
		packageToEdit.setoY(oYIn);
		packageToEdit.setWidth(sizeXIn);
		packageToEdit.setHeight(sizeYIn);	
	}
	
	public void commitEdits(String nameIn, int height, int width){
		packageToEdit.setName(nameIn);
		packageToEdit.setWidth(width);
		packageToEdit.setHeight(height);
	}
	public void update(Observable obj, Object arg){
		if (arg instanceof PackageImpl){
			this.packageToEdit = (PackageImpl) arg;
		}	
	}
	

	
	public void setPackageImpl(PackageImpl changedPackageImpl ){
		packageToEdit = changedPackageImpl;
	}
		
	public String getName(){
		return packageToEdit.getName();
	}
	
	public int getXPos(){
		return packageToEdit.getoX();
	}
	
	public int getyPos(){
		return packageToEdit.getoY();
	}
	
	public int getSizeX(){
		return packageToEdit.getWidth();
	}
	
	public int getySizeY(){
		return packageToEdit.getHeight();
	}

}
